package com.zxmr.timer;

import java.util.Timer;
import java.util.TimerTask;

import com.zxmr.rabbit.ChannelFactory;
import com.zxmr.rabbit.ConnectionManager;

public class ReEstablishConnection extends TimerTask{

	int timer;
	public ReEstablishConnection(int timer)
	{
		this.timer = timer;
	}
	@Override
	public void run() {
		
		if(!ChannelFactory.reEstablishConnection())
		{
			ReEstablishConnection task = new ReEstablishConnection(this.timer);
			Timer timer = new Timer();
			timer.schedule(task, this.timer);
		}else
		{
			ConnectionManager.resetConnectionComplete();
		}
	}

}
